﻿<UserControl x:Class="Atlanchim.Crm.Mui.Pages.Actions.PageListActions"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
             xmlns:mui="http://firstfloorsoftware.com/ModernUI"
             xmlns:lmondeilConverters="clr-namespace:Atlanchim.Crm.Mui.Pages.Actions"
             mc:Ignorable="d" 
             d:DesignHeight="300" d:DesignWidth="300">
    <Grid Style="{StaticResource ContentRoot}">
        <ScrollViewer>
            <StackPanel MinWidth="200">
                
                <!--Entête-->
                <StackPanel Orientation="Horizontal">
                    <TextBlock Text="Actions" Style="{StaticResource Heading2}" />
                </StackPanel>
                
                <!--Boutons d'action-->
                <mui:ModernButton Content="Ajouter"
                                  Command="NavigationCommands.GoToPage" CommandParameter="{Binding Path=NewEntityUrl}"
                                  IconData="{StaticResource ResourceKey=LmondeilAddButtonPath}" Foreground="{StaticResource ResourceKey=LmondeilAddButtonColor}"/>
                
                <!--Liste des actions-->
                <DataGrid ItemsSource="{Binding Path=ActionsList}" AutoGenerateColumns="False"
                      CanUserResizeColumns="True" CanUserSortColumns="True" ColumnHeaderStyle="{DynamicResource headerStyle}" >
                    <DataGrid.Columns>
                        <DataGridTemplateColumn Header="Date" IsReadOnly="True" SortMemberPath="Date" Width="Auto">
                            <DataGridTemplateColumn.CellTemplate>
                                <DataTemplate>
                                    <Button HorizontalContentAlignment="Left" Content="{Binding Path=Date,StringFormat='dd/MM/yyyy'}"
                                    Command="NavigationCommands.GoToPage" CommandParameter="{Binding Converter={lmondeilConverters:ActionToViewUrlConverter}}" Background="{x:Null}" BorderBrush="{x:Null}"/>
                                </DataTemplate>
                            </DataGridTemplateColumn.CellTemplate>
                        </DataGridTemplateColumn>
                        <DataGridTemplateColumn Header="Titre" IsReadOnly="True" SortMemberPath="Titre" Width="*">
                            <DataGridTemplateColumn.CellTemplate>
                                <DataTemplate>
                                    <Button HorizontalContentAlignment="Left" Content="{Binding Path=Titre}"
                                    Command="NavigationCommands.GoToPage" CommandParameter="{Binding Converter={lmondeilConverters:ActionToViewUrlConverter}}" Background="{x:Null}" BorderBrush="{x:Null}"/>
                                </DataTemplate>
                            </DataGridTemplateColumn.CellTemplate>
                        </DataGridTemplateColumn>
                    </DataGrid.Columns>
                </DataGrid>
            </StackPanel>
        </ScrollViewer>
    </Grid>
</UserControl>
